package com.tarena.lbs.coupon.service.impl;

import com.tarena.lbs.coupon.dao.repository.CouponRepository;
import com.tarena.lbs.coupon.dao.repository.StockRepository;
import com.tarena.lbs.coupon.service.StockService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Slf4j
@Service
public class StockServiceImpl implements StockService {
    @Autowired
    private CouponRepository couponRepository;
    @Autowired
    private StockRepository stockRepository;
    @Override
    public void addStock(Integer couponId, Integer count) {
        stockRepository.addStock(couponId, count);
        log.debug("新增库存成功: {}", couponId);
    }
    @Override
    public void updateStock(Integer couponId, Integer count) {
        stockRepository.updateStock(couponId, count);
        log.debug("更新库存成功: {}", couponId);
    }
}